//#define __FORCE_TRACE__
//#define __FORCE_DEBUG__
//#define __FORCE_INFO__
#define THIS_FILE "ioc\locality.sqf"
#include <core_macros.h>

TRACE_1("Start",_this);

private "_result";
_result = false;
if (isMultiplayer) then {
	if (IS_STRING(_this)) then {
		_result = switch (toLower(_this)) do {
			case '': { true };
			case "all": { true };
			case "tous": { true };
			case "server": { isServer };
			case "serveur": { isServer };
			case "player": { !isDedicated && hasInterface };
			case "players": { !isDedicated && hasInterface };
			case "joueur": { !isDedicated && hasInterface };
			case "joueurs": { !isDedicated && hasInterface };
			case "clients": { !isDedicated };			
			case "headless": { (!(call mso_core_fnc_hasHC) && isServer) || {!isDedicated && !hasInterface}};
			case "hc": { (!(call mso_core_fnc_hasHC) && isServer) || {!isDedicated && !hasInterface}};
			default { false };
		};
	} else {
		if (IS_SCALAR(_this)) then {
			_result = switch (_this) do {
				case 0: { true }; // All
				case 1: { isServer }; // Server
				case 2: { !isDedicated && hasInterface }; // clients
				case 3: { (!(call mso_core_fnc_hasHC) && isServer) || {!isDedicated && !hasInterface}}; // HC or Server
				default { false }; // None
			};
		} else {
			if (IS_OBJECT(_this)) then {
				_result = (local _this);
			};	
		};
	};
} else {
	_result = true;
};
TRACE_1("End",_result);
_result;